#!/usr/bin/env python
# -*- coding: utf-8 -*-
from xml.etree import ElementTree as ET
seedidfile = ET.parse('seed.xml')
seeds = []
fruits = []
ranchfile = ET.parse('animals.xml')
ranch_list = []
for elm in ranchfile.findall('item'):
    i = []
    i.append(elm.find('name').text)
    i.append(elm.find('skey').text)
    ranch_list.append(i)
for elm in seedidfile.findall('item'):
    i = {}
    i['name'] = elm.find('name').text
    i['seedid'] = elm.find('seedid').text
    seeds.append(i)
    if elm.find('name').text in [u'何首乌',u'神秘玫瑰',u'郁金香',u'友谊花',u'爱情果']:
        pass
    else:
        fruits.append(i)
fruits.append({'name':u'黄玫瑰','seedid':'35'})
fruits.append({'name':u'粉玫瑰','seedid':'34'})
fruits.append({'name':u'白玫瑰','seedid':'33'})
fruits.append({'name':u'双色玫瑰','seedid':'32'})
fruits.append({'name':u'蓝色妖姬','seedid':'31'})
fruits.append({'name':u'黑玫瑰','seedid':'30'})
fruits.append({'name':u'绿玫瑰','seedid':'29'})
fruits.append({'name':u'黑郁金香','seedid':'43'})
fruits.append({'name':u'绿郁金香','seedid':'44'})
fruits.append({'name':u'粉郁金香','seedid':'45'})
fruits.append({'name':u'白郁金香','seedid':'46'})
fruits.append({'name':u'红郁金香','seedid':'47'})
fruits.append({'name':u'多色郁金香','seedid':'55'})
fruits.append({'name':u'人形何首乌','seedid':'82'})
fruits.append({'name':u'何首乌','seedid':'81'})
fruits.append({'name':u'人参(有人参娃娃)','seedid':'25'})
fruits.append({'name':u'七彩玫瑰','seedid':'62'})

configfile = ET.parse('config.xml')
global_logoption = bool(eval(configfile.find('logoption').text))
global_autoseed = bool(eval(configfile.find('autoseed').text))
global_autoseedselection = configfile.find('autoseedselection').text
global_timeroption = bool(eval(configfile.find('timeroption').text))
global_timervalue = configfile.find('timervalue').text

if configfile.find('steallist').text:
    global_steallist = configfile.find('steallist').text.split(',')
else:
    global_steallist = []

if configfile.find('steallist_ranch').text:
    global_steallist_ranch = configfile.find('steallist_ranch').text.split(',')
else:
    global_steallist_ranch = []

global_friends_choice = int (configfile.find('friendschoice').text )

if configfile.find('connection_delay') != None:
    global_connet_delay = int( configfile.find('connection_delay').text )
else:
    global_connet_delay = 3

if configfile.find('jobs_list').text:
    global_jobs_list = configfile.find('jobs_list').text.split(',')
else:
    global_jobs_list = []

currentUser = ''


